<template>
  <div class="attend_steps" v-loading="loadingFlag">
    <div v-if="stepList.length">
      <div v-for="(item, index) in stepList" :key="index">
        <div class="steps_title">
          <div class="steps_tit_circle" :class="{ is_success: item.approveStatus == '1' }">
            {{ index + 1 }}
            <span
              :class="{
                select_circle: item.approveStatus == '1',
                'el-icon-success': item.approveStatus == '1',
              }"></span>
          </div>
          <div class="steps_tit_r">
            <p class="steps_tit_rl">{{ item.noteName }}</p>
            <p class="steps_tit_time">{{ item.approveTime }}</p>
          </div>
        </div>
        <div class="steps_content">
          <div class="steps_content_cont" :class="stepList.length != index + 1 ? 'steps_lines' : 'steps_lines_no'">
            <div v-if="item.userName">
              执行人：
              <span class="des_name">{{ item.userName }}</span>
            </div>
            <div
              v-if="item.approveContent || item.approveType"
              class="steps_content_quest"
              :class="{ item_red: item.approveType == '审批不通过' }">
              {{ item.approveType }}
              <span v-if="item.approveContent">：{{ item.approveContent }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div v-else class="no_data">暂无审批流程</div>
  </div>
</template>

<script>
import { getFlowApproveListRepair } from '@apis/api-dailyManage.js'
export default {
  components: {},
  props: {
    activeInfo: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      stepList: [],
      loadingFlag: false,
    }
  },
  watch: {
    activeInfo: {
      handler(news) {
        if (news.processInstanceId) {
          this.loadingFlag = true
          setTimeout(() => {
            this.getFlowApproveListRepair()
          }, 1000)
        }
      },
      deep: true,
      // immediate: true,
    },
  },
  created() {},
  mounted() {},
  methods: {
    getFlowApproveListRepair() {
      getFlowApproveListRepair({
        id: this.activeInfo.id,
        processInstanceId: this.activeInfo.processInstanceId,
      }).then(res => {
        this.loadingFlag = false
        this.stepList = res.data
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.attend_steps {
  font-size: 14px;
  .steps_title {
    display: flex;
    height: 30px;
    .steps_tit_circle {
      height: 30px;
      width: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
      border: 2px solid #ececec;
      position: relative;
    }
    .is_success {
      border-color: #0080ff;
    }
    .select_circle {
      color: #67c23a;
      display: inline-block;
      position: absolute;
      top: 13px;
      left: 12px;
      font-size: 18px;
    }
    .steps_tit_r {
      margin-left: 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex: 1;
    }
    .steps_tit_rl {
      flex: 1;
    }
    .steps_tit_time {
      color: #909399;
      white-space: nowrap;
    }
  }
  .steps_content {
    min-height: 70px;
    display: flex;
    .steps_content_line {
      height: 100%;
      min-height: 70px;
      width: 30px;
      display: flex;
      justify-content: center;
      .line_one {
        height: 100%;
        min-height: 70px;
        width: 2px;
        background-color: #0080ff;
        display: inline-block;
      }
    }
    .steps_lines {
      border-left: 2px solid #0080ff;
      min-height: 70px;
      margin-left: 14px;
      padding-left: 25px;
    }
    .steps_lines_no {
      margin-left: 45px;
    }
    .steps_content_cont {
      flex: 1;
      height: 100%;
      padding-top: 10px;
      padding-bottom: 10px;
      .item_red {
        color: #f56c6c;
      }
      .des_name {
        color: #3863a3;
      }
      .steps_content_quest {
        margin-top: 10px;
        border: 1px solid #ececec;
        padding: 4px 8px;
        background-color: #e4ebf0;
        position: relative;
        word-break: break-all;
        &::after {
          content: ' ';
          position: absolute;
          top: -13px;
          left: 10px;
          width: 0;
          height: 0;
          border-top: 6px solid transparent;
          border-left: 8px solid transparent;
          border-right: 8px solid transparent;
          border-bottom: 8px solid #e4ebf0;
        }
      }
    }
  }
  .no_data {
    text-align: center;
    font-size: 18px;
    color: #909399;
    line-height: 100px;
  }
}
/deep/.el-loading-mask {
  z-index: 1998 !important;
}
</style>
